class Dictionary < ActiveRecord::Base
  attr_accessible :name , :description ,:dictionary_json ,:word_json

  def self.output_csv(id)
    dic = Oj.load(Dictionary.find(id).try(:word_json))
    csv_string = CSV.generate do |csv|
        dic.each do |word|
          csv << [word]
        end
    end

    return csv_string
  end
end
